package com.design.pattern.state.base;

import lombok.Getter;
import lombok.Setter;
import org.springframework.context.annotation.Lazy;

import javax.annotation.Resource;

/**
 * @author 王霄
 * @date 2022/3/10 20:34
 */
public abstract class CarState {

    @Getter
    @Setter
    protected Context context;

    @Resource
    @Lazy
    protected CarStateManager stateManager;

    protected abstract StateEnum getState();

    public void open() {
        throw new RuntimeException("当前状态不能更改为开门状态");
    }

    public void close() {
        throw new RuntimeException("当前状态不能更改为关门状态");
    }

    public void run() {
        throw new RuntimeException("当前状态不能更改为行驶状态");
    }

    public void stop() {
        throw new RuntimeException("当前不能更改为停止状态");
    }
}
